#ifndef LOGIC_EDIT_H
#define LOGIC_EDIT_H

#include <iostream>
#include <string>
#include <vector>

#include "Parser.h"
#include "Data.h"
#include "Task.h"
#include "Writer.h"

#include <boost\date_time.hpp>

using namespace std;
using namespace boost::posix_time;
using namespace boost::gregorian;

class LogicEdit {
public:
	string editTaskByName(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector,
							Data* _data,
							Writer* _writer);

	string editTaskByStartTime(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector,
							Data* _data,
							Writer* _writer);

	string editTaskByEndTime(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector,
							Data* _data,
							Writer* _writer);

	string editTaskByStartDateTime(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector,
							Data* _data,
							Writer* _writer);

	string editTaskByEndDateTime(Parser::PARSED_COMMAND parsedCommand, 
							vector<Task>& tasksVector,
							Data* _data,
							Writer* _writer);

private:
	Task _task;

	static const string EDIT_SUCCESS_MESSAGE;

	static const string EDIT_ERROR_MESSAGE;

	static const string NO_CHANGES_ERROR_MESSAGE;
	static const string INDEX_OUT_OF_BOUNDS_ERROR_MESSAGE;

	bool isOutOfBounds(int index, int size);
	void copyTasks(vector<Task>& tasks, vector<Task>& tasksVector);
};
#endif